

message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")

set (CMAKE_CXX_STANDARD 11)

IF(WIN32)
    add_definitions(-D__X2LIB_WIN32__)
    add_definitions(-DWIN32_LEAN_AND_MEAN)
	add_definitions(-D_LIB)
	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
	
	IF(DEBUG_OPTIONS_CMAKE)
        set(CMAKE_BUILD_TYPE "Debug")
		add_definitions(-D__DEBUG__)
		add_definitions(-D__X2LIB_DEBUG__)
		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MTd")
		set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MTd")
		set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
	ELSE(DEBUG_OPTIONS_CMAKE)
        set(CMAKE_BUILD_TYPE "Release")
		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
		set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
		set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
	ENDIF()
ELSEIF(LINUX)
    add_definitions(-D__X2LIB_LINUX__)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
	
	IF(DEBUG_OPTIONS_CMAKE)
        add_definitions(-D__DEBUG__)
        add_definitions(-D__X2LIB_DEBUG__)
        set(CMAKE_BUILD_TYPE "Debug")
	ELSE(DEBUG_OPTIONS_CMAKE)
        set(CMAKE_BUILD_TYPE "Release")
	ENDIF()
ELSEIF(MACOS)
    add_definitions(-D__X2LIB_MACOS__)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") 
	# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-conversion")
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
	
	IF(DEBUG_OPTIONS_CMAKE)
		add_definitions(-D__DEBUG__)    
        add_definitions(-D__X2LIB_DEBUG__)
        set(CMAKE_BUILD_TYPE "Debug")
	ELSE(DEBUG_OPTIONS_CMAKE)
        set(CMAKE_BUILD_TYPE "Release")
	ENDIF()
ENDIF()

